package app.caretrack.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "MachinePositions")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class MachinePosition {
    private int id;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private Date msgReceivedTimestamp;

    private Machine machine;

    public Date getMsgReceivedTimestamp() {
        return this.msgReceivedTimestamp;
    }

    public void setMsgReceivedTimestamp(Date msgReceivedTimestamp) {
        this.msgReceivedTimestamp = msgReceivedTimestamp;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    public Machine getMachine() {
        return this.machine;
    }

    public void setMachine(Machine machine) {
        this.machine = machine;
    }

}
